Class sjl.FrontInsertIterator
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sjl.FrontInsertIterator

java.lang.Object
   |
   +----sjl.Iter
           |
           +----sjl.FrontInsertIterator

public class FrontInsertIterator
extends Iter
implements OutputIterator
An Iterator adapter that causes all assignment operations (put) to be converted into an push_front() operation. When the FrontInsertIterator is constructed a container which implements the FrontInsertContainer interface must be supplied. Currently the List and the Deque implements FrontInsertIterator.

Copyright © 1996 Finn Bock

See Also:
List, Deque

Constructor Index

 o FrontInsertIterator(FrontInsertContainer)
Construct an insert iterator for the container, which convert all assigments (put) into the push_front method.

Method Index

 o cmp(Iterator)
Invalid.
 o genericCopy()
Return this.
 o next()
Do nothing.
 o put(Object)
Insert object at the front of the container.
 o setTo(Iterator)
Assign this iterator to another container.

Constructors

 o FrontInsertIterator
  public FrontInsertIterator(FrontInsertContainer container)
Construct an insert iterator for the container, which convert all assigments (put) into the push_front method. The container must be a FrontInsertContainer, that is, it must support the push_front method.

Methods

 o put
  public Object put(Object object)
Insert object at the front of the container.
Parameters:
object - The object that will be inserted in the container
Returns:
object is returned.
 o next
  public Iterator next()
Do nothing. All assignment to this iterator will always be at the front of the container, so advancing the iterator is ignored.
 o cmp
  public boolean cmp(Iterator i)
Invalid. This method is inherited from Iterator, but should not exist in an OutputIterator. XXX: Throw an exception perhaps??.
 o genericCopy
  public Iterator genericCopy()
Return this. Since insert iterators does not maintain any position, there is no need for actually clone the iterator.
 o setTo
  public void setTo(Iterator i)
Assign this iterator to another container. This is faster than creating a new FrontInsertIterator object.

All Packages  Class Hierarchy  This Package  Previous  Next  Index